package Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class demo5 {
    public static void main(String[] args) throws ParseException {
        String startStr = "2023-10-13 00:00:00";
        String endStr = "2023-10-13 00:10:00";
        String orderStr = "2023-10-13 00:11:00";
        SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd hh: mm:ss");
        Date start = sdf.parse(startStr);
        Date end = sdf.parse(endStr);
        Date order = sdf.parse(orderStr);
        long startTime = start.getTime();
        long endTime = end.getTime();
        long orderTime = order.getTime();
        if(startTime <= orderTime &&endTime >= orderTime){
            System.out.println("参加秒杀活动成功");
        }else {
            System.out.println("参加失败");
        }
    }
}
